﻿<cfmodule template="../../tag/layout.cfm" bodyIsEasyUILayout="false">
<form method="post" class="form">
  <fieldset>
    <legend>基本信息</legend>
    <table class="table" width="100%">
      <tbody>
        <th>选择文件</th>
	      <td>
	      	<select class="selectFiles"><option>选择文件</option></select>
	      	<a href="#" class="easyui-linkbutton uploader" data-options="iconCls:'icon-add'">选择文件</a>
	      	<input name="pic" id="pic" class="selectFilesValue easyui-validatebox" type="hidden"  data-options="required:true" />
	      </td>
        </tr>
      </tbody>
    </table>
  </fieldset>
</form>
</cfmodule>
<script type="text/javascript">
	var closeDialog = function($dialog) {
		$dialog.dialog('destroy');
	}

	var submitNow = function($dialog, $grid) {
		var url;
		url ='?action=store.importFile&id=' + $('#pic').val();

		$.post(url, fw.serializeObject($('form')), function(result) {
			if (result) {
				$.messager.progress('close');
				$grid.datagrid('reload');
				$dialog.dialog('destroy');
			}
		}, 'json');
	};

	var submitForm = function($dialog, $grid) {
		if (!$('form').form('validate')) {
			 $.messager.alert('提示','请选择文件！','warning');
		}else{
			$.messager.progress({
				text : '数据加载中....'
			});
			submitNow($dialog, $grid);
		}
	};


	$(function(){
		$(".uploader").on('click',uploaderFun);
	})
</script>
